<template>
  <div>
    <el-popover placement="top-start" title="扫码下载APP" width="auto" trigger="hover">
      <template #reference>
        <!-- <el-link type="primary" class="link-type">APP下载</el-link> -->
      </template>
      <canvas class="qrcode" ref="qrcodeCanvas" />
    </el-popover>
  </div>
</template>
<script setup>
  import QRCode from "qrcode";
  const { proxy } = getCurrentInstance();

  /**
   * app下载二维码
   */
  const generateQRCode = () => {
    const canvas = proxy.$refs.qrcodeCanvas;
    QRCode.toCanvas(
      canvas,
      "http://183.92.128.122:9007/pureut2/2024/09/23/cde9b549e9d74dec8a9dd95471589303.apk",
      (error) => {
        if (error) console.error(error);
      }
    );
  };

  onMounted(() => {
    generateQRCode();
  });
</script>

<style scoped lang="scss">
  .qrcode {
    width: 80px;
    height: 80px;
  }
</style>